# {{artifactId}}

## Requirements

Building the API client library requires [Maven](https://maven.apache.org/) to be installed.

## Installation

To install the API client library to your local Maven repository, simply execute:

```shell
mvn install
```

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

```shell
mvn deploy
```

Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information.

### Maven users

Add this dependency to your project's POM:

```xml
<dependency>
    <groupId>{{{groupId}}}</groupId>
    <artifactId>{{{artifactId}}}</artifactId>
    <version>{{{artifactVersion}}}</version>
    <scope>compile</scope>
</dependency>
```

### Gradle users

Add this dependency to your project's build file:

```groovy
compile "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}"
```

### Others

At first generate the JAR by executing:

    mvn package

Then manually install the following JARs:

- target/{{{artifactId}}}-{{{artifactVersion}}}.jar
- target/lib/*.jar

## Getting Started

Please follow the [installation](#installation) instruction and execute the following Java code:

```java
{{#readmeSnippet}}
{{{.}}}
{{/readmeSnippet}}
{{^readmeSnippet}}
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
// Import classes:
import {{{invokerPackage}}}.ApiClient;
import {{{invokerPackage}}}.ApiException;
import {{{invokerPackage}}}.Configuration;{{#hasAuthMethods}}
import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}}
import {{{invokerPackage}}}.model.*;
import {{{package}}}.{{{classname}}};

public class Example {
  public static void main(String[] args) {
    {{^hasAuthMethods}}
    ApiClient apiClient = Configuration.getDefaultApiClient();
    apiClient.setBasePath("{{{basePath}}}");
    {{/hasAuthMethods}}
    {{#hasAuthMethods}}
    {{#authMethods}}
    {{#-first}}
    {{#isApplication}}
    // Configure OAuth2 client credentials for "application" OAuth flow
    String clientId = System.getenv("CLIENT_ID");
    String secretId = System.getenv("CLIENT_SECRET");
    ApiClient apiClient = new ApiClient(clientId, secretId, null);

    // Set custom base path if desired
    // apiClient.setBasePath("{{{basePath}}}");{{/isApplication}}{{^isApplication}}
    ApiClient apiClient = Configuration.getDefaultApiClient();
    apiClient.setBasePath("{{{basePath}}}");
    {{/isApplication}}
    {{/-first}}
    {{/authMethods}}
    {{/hasAuthMethods}}
    {{#hasAuthMethods}}
    {{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
    // Configure HTTP basic authorization: {{{name}}}
    HttpBasicAuth {{{name}}} = (HttpBasicAuth) apiClient.getAuthentication("{{{name}}}");
    {{{name}}}.setUsername("YOUR USERNAME");
    {{{name}}}.setPassword("YOUR PASSWORD");{{/isBasicBasic}}{{#isBasicBearer}}
    // Configure HTTP bearer authorization: {{{name}}}
    HttpBearerAuth {{{name}}} = (HttpBearerAuth) apiClient.getAuthentication("{{{name}}}");
    {{{name}}}.setBearerToken("BEARER TOKEN");{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
    // Configure API key authorization: {{{name}}}
    ApiKeyAuth {{{name}}} = (ApiKeyAuth) apiClient.getAuthentication("{{{name}}}");
    {{{name}}}.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}}{{^isApplication}}
    // Configure OAuth2 access token for authorization: {{{name}}}
    OAuth {{{name}}} = (OAuth) apiClient.getAuthentication("{{{name}}}");
    {{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isApplication}}{{/isOAuth}}
    {{/authMethods}}
    {{/hasAuthMethods}}

    {{{classname}}} apiInstance = new {{{classname}}}(apiClient);
    {{#allParams}}
    {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}}
    {{/allParams}}
    try {
      {{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}}
            .{{{paramName}}}({{{paramName}}}){{/optionalParams}}
            .execute();{{/vendorExtensions.x-group-parameters}}{{#returnType}}
      System.out.println(result);{{/returnType}}
    } catch (ApiException e) {
      System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
{{/readmeSnippet}}
```

## Documentation for API Endpoints

All URIs are relative to *{{basePath}}*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}

## Documentation for Models

{{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md)
{{/model}}{{/models}}

## Documentation for Authorization

{{^authMethods}}All endpoints do not require authorization.
{{/authMethods}}Authentication schemes defined for the API:
{{#authMethods}}### {{name}}

{{#isApiKey}}- **Type**: API key

- **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}}
{{#isBasic}}- **Type**: HTTP basic authentication
{{/isBasic}}
{{#isOAuth}}

- **Type**: OAuth
- **Flow**: {{flow}}
- **Authorization URL**: {{authorizationUrl}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}}  - {{scope}}: {{description}}
{{/scopes}}
{{/isOAuth}}

{{/authMethods}}

## Recommendation

It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
